<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="Comment.CommentDeal"%>
<html>
  <head>
    <title>评分模块</title>
 
	
<!--javaScript函数validate(),用来验证是否选择了评分-->
<script lauguage="JavaScript">
<!--
	function validate(){
		var r0=document.form.r[0].checked||document.form.r[1].checked||document.form.r[2].checked||document.form.r[3].checked||document.form.r[4].checked;
		if(!r0){
			alert("请您选择！");
			return false;
		}
	} 
 -->
 </script>
  </head>
  
  <body>
  <%
        CommentDeal Comment=new CommentDeal();
  		String SellerID=request.getParameter("SellerID");
        //String SellerID=Comment.CalSeller(GridID);
        Float Score=Comment.CalScore(SellerID);
  %>
   <form id="form" name="form" method="post" action="SaveComment.jsp?SellerID=<%=SellerID%>" onSubmit="javaScript: return validate();">
  <table width="200" height="20" border="2" align="center" cellpadding="0" cellspacing="0" style="width: 312px; height: 132px;">
  <tr >	
 	 <td width="200"height="30" colspan="0" align="left">
 	 	<ul align="center"> 
	 	
			  <label>
			  	<input type="radio" name="r" value="1" />1分</label>
			  <label>
			  	<input type="radio" name="r" value="2" />2分</label>
			  <label>
			  	<input type="radio" name="r" value="3" />3分</label>
			  <p>
			    <label>
			    	<input type="radio" name="r" value="4" />4分</label>
			    <label>
			    	<input type="radio" name="r" value="5" />5分
			    </label>
			  </p>
 	
 	 	</ul>
 	 	
 	 	<%javax.servlet.http.Cookie cookies[]=request.getCookies();
		   boolean voted=false;
		   try{
		   for(int i=0;i<cookies.length;i++)
		   {
		   	if((cookies[i].getName().equals("votedCookie"))&&(cookies[i].getValue().equals("true")))
		   	{
		   		voted=true;
		   		break;
		   	}
		   }
		   }catch(Exception e){
			   e.printStackTrace();
		   }
		   
 	 	%>
 	 	<%if(!voted)
 	 	{
 	 	%>
 	 	<ul height=”50“，align="center">
 	 	<input type="submit" value="给卖家打分" name="sunmit">
 	 	</ul> 
 	 	<%}else{%>
 	 	<ul height=”50“，align="center">
 	 	<font color="red">已经投过票了</font>
 	 	</ul> 
 	 	<% 
 	 	}
 	 	%>

 	 	
 	 </td>
 	 <td align="center">
 	 <p>平均分</p>
 	 <p><font color="#FF0000" size="9" valign="center"><%=Score%></font></p>
 	 <a href="CommentDetailed.jsp?SellerID=<%=SellerID%>">查看详细得分</a>
 	 </td>
  </tr>
  </table>
	</form>
  </body> 
</html>
